from django.db import models
from apps.common.base.models import BaseModel
from apps.system.lessee.models import Lessee

class Identity(BaseModel):

    lessee = models.ForeignKey(Lessee, related_name="lessee_identity", verbose_name='租户', on_delete=models.SET_NULL, null=True, blank=True, db_constraint=False)
    name=models.CharField("名称", max_length=200, blank=True, null=True)
    grade=models.IntegerField("级别", default=0)

    # 升级条件
    verticalPeopleNumber = models.IntegerField("直推人数", default=0)
    verticalPerformance = models.DecimalField("直推业绩", max_digits=50, decimal_places=2, default=0.00)
    identityPerformance = models.DecimalField("团队业绩", max_digits=50, decimal_places=2, default=0.00)
    # 分成比例
    awardRate = models.DecimalField("直推奖比例", max_digits=10, decimal_places=2, default=0.00)

    class Meta:
        verbose_name = 'Identity'
        verbose_name_plural = verbose_name